<div class="modal-header">
    <h3 class="modal-title">
        <b style="color: #286090">{{workflowTodo.workflowDO.title}}</b>自动化工作流
    </h3>
    <div>
        <b ng-show="workflowTodo.workflowDO.wfType == 0" class="pull-left">OPS</b>
        <i uib-popover-html="assigneeUsersInfo" popover-trigger="'mouseenter'" popover-placement="bottom"
           class="icon icon-info" style="color: green;"></i>
    </div>
</div>

<div class="modal-body">
    <form class="form-horizontal" style="padding: 10px;">
        <div class="form-group">
            <div class="col-md-6">
                <label class="col-lg-4 control-label">RAM登录账户</label>
                <div class="col-lg-8">
                    <input type="text" class="form-control" readonly
                           ng-show="ramUser == null || ramUser.ramUserName == ''"
                           ng-model="user.username">
                    <input type="text" class="form-control" readonly
                           ng-show="ramUser !=null && ramUser.ramUserName != ''"
                           ng-model="ramUser.ramUserName">
                </div>
            </div>

            <div class="col-md-6">
                <label class="col-lg-4 control-label">RAM登录密码</label>
                <div class="col-lg-8">
                    <input type="text" class="form-control" placeholder="在'个人详情-密码'中查看" readonly>
                </div>
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg-2 control-label"><span style="color: #ec2121;">*</span>RAM用户标签</label>
            <div class="col-lg-5">
                <input type="text" class="form-control" placeholder="格格家-技术部"
                       ng-model="ramUser.userTag">
            </div>
            <div class="col-lg-2">
                <button ng-click="saveRamUser()" class="btn btn-xs"
                        style="margin-top: 5px; background-color: #2b669a; color: white;"
                        uib-popover-html="'保存标签用户识别用户'" popover-trigger="'mouseenter'">
                    <span class="glyphicon glyphicon-ok"></span>保存标签
                </button>
            </div>
        </div>
        <div class="form-group">
            <div class="col-md-12">
                <label class="col-lg-2 control-label">登录地址</label>
                <div class="col-lg-10">
                    <a type="button" class="btn"
                       href="https://signin.aliyun.com/1255805305757185.onaliyun.com/login.htm" target="_blank"
                       style="background-color: #ff8700; color: white;"><span
                            class="fa fa-share"></span>登录地址https://signin.aliyun.com/1255805305757185.onaliyun.com/login.htm
                    </a>
                </div>
            </div>
        </div>

        <div class="form-group" ng-show="type == 0">
            <label class="col-lg-2 control-label"><span style="color: #ec2121;">*</span>RAM策略</label>
            <div class="col-lg-5">
                <ui-select ng-model="nowRamPolicy.selected" theme="bootstrap">
                    <ui-select-match placeholder="搜索策略或描述......">{{$select.selected.policyName}}</ui-select-match>
                    <ui-select-choices refresh="queryRamPolicy($select.search)" refresh-dalay="0"
                                       repeat="item in ramPolicyList | filter: $select.search">
                        <div ng-bind-html="item.policyName | highlight: $select.search"></div>
                    </ui-select-choices>
                </ui-select>
            </div>
            <div class="col-lg-2">
                <button ng-click="addItem()" class="btn btn-xs"
                        style="margin-top: 5px; background-color: limegreen; color: white;"
                        uib-popover-html="'附加授权'" popover-trigger="'mouseenter'">
                    <span class="glyphicon glyphicon-plus"></span>添加
                </button>
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg-2 control-label"><span style="color: #ec2121;">*</span>申请RAM策略</label>
            <div class="col-lg-10">
                <table class="table table-hover table-bordered table-striped">
                    <thead>
                    <tr>
                        <td>策略名称</td>
                        <td>描述</td>
                        <td class="col-md-2"
                            ng-show="workflowTodo.todoStatus == 0 && workflowTodo.todoPhase == 0 && type == 0">操作
                        </td>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-show="todoDetail.detail.detailType ==1" ng-repeat="todoDetail in workflowTodo.todoDetails">
                        <div ng-show="todoDetail.detail.detailType == 1">
                            <!--用户信息-->
                            <td>
                                <span style="background-color: #2b669a ;color: white;"
                                      uib-popover-html="'新申请的阿里云RAM策略'"
                                      popover-trigger="'mouseenter'"
                                      class="label">{{todoDetail.name}}</span>
                            </td>
                            <td>{{todoDetail.detail.content}}</td>
                            <td ng-show="workflowTodo.todoStatus == 0 && workflowTodo.todoPhase == 0 && type == 0">
                                <button ng-click="delItem(todoDetail)" class="btn btn-xs pull-left"
                                        style="background-color: #d9534f; color: white;"
                                        uib-popover-html="'移除申请的RAM策略'" popover-trigger="'mouseenter'">
                                    <span class="glyphicon glyphicon-remove"></span>移除
                                </button>
                            </td>
                        </div>
                    </tr>
                    </tbody>

                    <tfoot>
                    </tfoot>
                </table>
            </div>
        </div>

        <div class="form-group">
            <label class="col-lg-2 control-label">我的RAM策略</label>
            <div class="col-lg-10">
                <table class="table table-hover table-bordered table-striped">
                    <thead>
                    <tr>
                        <td>策略名称</td>
                        <td class="col-md-2"
                            ng-show="workflowTodo.todoStatus == 0 && workflowTodo.todoPhase == 0 && type == 0">操作
                        </td>
                    </tr>
                    </thead>
                    <tbody>
                    <tr ng-show="todoDetail.detail.detailType ==0" ng-repeat="todoDetail in workflowTodo.todoDetails">
                        <td>
                            <span style="background-color: #2ea8e5 ;color: white;"
                                  uib-popover-html="'已经授权的阿里云RAM策略'"
                                  popover-trigger="'mouseenter'"
                                  class="label">{{todoDetail.name}}</span>
                        </td>
                        <td ng-show="workflowTodo.todoStatus == 0 && workflowTodo.todoPhase == 0 && type == 0">
                            <button ng-click="setDetachPolicy(todoDetail)" class="btn btn-xs pull-left"
                                    ng-show="todoDetail.detail.detachPolicy == false"
                                    style="background-color: #d9534f; color: white;"
                                    uib-popover-html="'将已有的策略删除'" popover-trigger="'mouseenter'">
                                <span class="glyphicon glyphicon-remove"></span>撤销授权
                            </button>

                            <button ng-click="setDetachPolicy(todoDetail)" class="btn btn-xs pull-right"
                                    ng-show="todoDetail.detail.detachPolicy == true"
                                    style="background-color: #449d44; color: white;"
                                    uib-popover-html="'取消操作'" popover-trigger="'mouseenter'">
                                <span class="glyphicon glyphicon-remove"></span>取消
                            </button>
                        </td>
                    </tr>
                    </tbody>

                    <tfoot>
                    </tfoot>
                </table>
            </div>
        </div>


        <div class="form-group">
            <label class="col-lg-2 control-label">申请说明</label>
            <div class="col-lg-10">
                            <textarea class="form-control" cols="3" placeholder="简短描述（小于100字）"
                                      ng-model="workflowTodo.content"></textarea>
            </div>
        </div>
    </form>

    <div style="width: 100%; height: 1px; border: 0.5px solid #eee;"></div>

    <!--<div class="modal-body">-->
    <form class="form-horizontal" style="margin-top: 35px;">
        <div ng-include="'tpl/modal/workflow/todo_approval_info.html'"></div>
    </form>
    <!--</div>-->
</div>

<div class="modal-footer">
    <div class="form-group">
        <div style="text-align:center;">
            <button class="btn btn-xs" ng-show="workflowTodo.todoStatus == 0 && workflowTodo.todoPhase == 0"
                    style="margin-right: 25px; background-color: green; color: white;"
                    ng-click="saveTodo()">
                <i class="fa fa-spin fa-spinner" ng-show="btnSaveing"></i>
                <i class="glyphicon glyphicon-ok" ng-show="!btnSaveing"></i>保存
            </button>
            <button class="btn btn-xs" ng-show="todoDetail.todoStatus != 0"
                    style="background-color: #ff8700; color: white;"
                    ng-click="closeModal()">关闭
            </button>
        </div>
    </div>


    <div ng-if="alert.type != ''">
        <div uib-alert ng-class="'alert-' + alert.type" close="closeAlert()">{{alert.msg}}</div>
    </div>
</div>